A formula calculator is a software calculator that can perform a calculation in two steps:
1. Enter the calculation by typing it in from the keyboard.
2. Press a single button or key to see the final result.[1][2][3][4][5][6]
This is unlike button-operated calculators, such as the Windows calculator or the Mac OS X calculator, which require the user to perform one step for each operation, by pressing buttons to calculate all the intermediate values, before the final result is shown.[7][8][9]
In this context, a formula is also known as an expression,[10] and so formula calculators may be called expression calculators.[11] Also in this context, calculation is known as evaluation,[12] and so they may be called formula evaluators, rather than calculators.[13]
Contents |
Formulas as they are commonly written use infix notation for binary operators, such as addition, multiplication, division and subtraction. This notation also uses:
Also, formulas may contain:
Once a formula is entered, a formula calculator follows the above rules to produce the final result by automatically:
Formulas printed in many text books use juxtaposition, underline and superscripts for multiplication, division and exponentiation respectively. Also, some operations, such as square root, are represented by special symbols that are not usually available on a computer keyboard. For example, see the formulas in Amortization calculator, Heron's formula and Law of cosines.
In many software tools, including spreadsheets and programming languages, the asterisk, *, is used for multiplication.[14] However, it is also possible to use juxtaposition.[15] For example:
2cos(3)
means 2 multiplied by cos(3).
In calculators that don’t allow juxtaposition, the asterisk (and possibly x rather than, or as well as, the asterisk), is used, and the calculation should be entered as:
2*cos(3)
Also, a period is sometimes used for multiplication, as in:
2.cos(3)
Because the period is also used as the decimal point in numbers, so that the “2.” in the above would be interpreted as 2.0, the period is not used for multiplication in a formula calculator, and this calculation should be entered using a different symbol, as above.
Printed formulas often use a horizontal line for division, but in a formula calculator that uses only keyboard symbols, division is entered using the forward slash, /. When there is a calculation above or below the line, this should be done first, and so it should be enclosed in parentheses when typed in. For example,
2 + 3 ————— 4 - 5
should be entered as
(2 + 3)/(4 - 5)
Also, the symbol ÷ is often used for division, as in
2 ÷ 3
This symbol is not available on most computer keyboards, so this division operation is entered using the forward slash, as above.
Exponentiation, or raising to a power, is often represented using a superscript. For example:
2.452
means 2.45 squared.
With the limitations of a computer keyboard, in some software packages, such as Microsoft Excel, this is entered using the caret, ^:
2.45^2
but two asterisks are also used:[14]
2.45**2
When using functions, the superscript is sometimes placed immediately after the function name. For example, it is common to write the trigonometric version of Pythagoras’ Theorem (List of trigonometric identities) as:
sin2(x) + cos2(x) = 1
In this identity,
sin2(x)
means the square of sin(x), and is the same as:
sin(x)2
So, for x = 3.25, it could be entered into a formula calculator that uses the caret for exponentiation as:
sin(3.25)^2
Square roots are often specified using the √ symbol, but with the limitations of a keyboard this is can be entered by using exponentiation. For example, the square root of 2:
√2
could be entered as:
2^(1/2)
but two asterisks are also used:[14]
2**(1/2)
The parentheses specify that the division should be done first.
All roots can be specified in this way. For example, the cube root of 2 can be entered as:
2^(1/3)
An example that illustrates these features is Heron’s formula.
One version of the formula, for a triangle with sides of length a, b and c, is equivalent to, using symbols that are available on a keyboard:
1/2*(a^2*c^2 - (a^2 + c^2 - b^2)/2)^0.5
For a = 2.5, b = 3.6 and c = 1.9, it could be entered into a formula calculator as:
1/2*(2.5^2*1.9^2 - (2.5^2 + 1.9^2 - 3.6^2)/2)^0.5
The formula calculator concept can be applied to all types of calculator, including arithmetic, scientific, statistics, financial and conversion calculators.
The calculation can be typed or pasted into an edit box of:
• A software package that runs on a computer, for example as a dialog box.[3][4][6]
• An on-line formula calculator hosted on a web site.[5]
It can also be entered on the command line of a programming language.[14]
Although they are not calculators in themselves, because they have a much broader feature set, many software tools have a formula-calculation capability, in that a formula can be typed in and evaluated. These include:
• Spreadsheets, where a formula can be entered to calculate a cell’s content.
• Databases, where a formula can be used to define the value of a calculated field in a record.
Button-operated calculators are imperative, because the user must provide details of how the calculation has to be performed.[16]
On the other hand, formula calculators are more declarative because the typed-in formula specifies what to do, and the user does not have to provide any details of the step-by-step order in which the calculation has to be performed.
Declarative solutions are easier to understand than imperative solutions,[16][17] and so there has been a long-term trend from imperative to declarative methods.[18][19] Formula calculators are part of this trend.
Many software tools for the general user, such as spreadsheets, are declarative.[20] Formula calculators are examples of such tools.
There are hybrid calculators that combine typed-in formula and button-operated calculation. For example:
• Calculations can be entered entirely from the keyboard, or operations can be applied to typed-in numbers or formulas using buttons, in the same calculator.[21]
• Formulas can be constructed using buttons, rather than being entered from the keyboard.[22]
• Formula copies of button-operated calculations can be created, saved and re-loaded for application to different numbers.[23]